﻿using CleanArchitecture.Infrastructure.Entities.Business;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace CleanArchitecture.Infrastructure.DataMapping.Business
{
    /// <summary>
    /// Represents a Comment mapping configuration
    /// </summary>
    public partial class CommentMap : NowaEntityTypeConfiguration<Comment>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<Comment> builder)
        {
            builder.ToTable("bus_comment");
            builder.HasKey(file => file.Id);

            builder.Property(file => file.EntityName).HasMaxLength(100).IsRequired();
            builder.Property(file => file.CommentTitle).HasMaxLength(200);
            builder.Property(file => file.CommentText).HasMaxLength(500);
            builder.Property(file => file.ContactName).HasMaxLength(50);
            builder.Property(file => file.ContactPhone).HasMaxLength(20);
            builder.Property(file => file.ContactEmail).HasMaxLength(100);
            builder.Property(file => file.ContactAddress).HasMaxLength(255);
            builder.Property(file => file.ImgIds).HasMaxLength(255);
            
            base.Configure(builder);
        }

        #endregion
    }
}
